package com.eduagent.xwqeduagent.controller;

import com.eduagent.xwqeduagent.api.TextCorrection.TextCorrectionResult;
import com.eduagent.xwqeduagent.service.TextCorrectionService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 文本纠错控制器
 */
@RestController
@RequestMapping("/text-correction")
@RequiredArgsConstructor
@Slf4j
public class TextCorrectionController {
    
    private final TextCorrectionService textCorrectionService;
    
    /**
     * 文本纠错接口
     * @return 纠错结果
     */
    @PostMapping("/form")
    public ResponseEntity<TextCorrectionResult> correctTextForm(
            @RequestParam("text") String text,
            @RequestParam(value = "uid", required = false, defaultValue = "") String uid,
            @RequestParam(value = "resId", required = false, defaultValue = "") String resId) {

        TextCorrectionResult result = textCorrectionService.correctText(text, uid, resId);
        return ResponseEntity.ok(result);
    }
} 